package dbManager;

import java.util.ArrayList;

/**
 * This class save for a file its tags
 */
public class FileTags 
{
	String fileName;
	String path;
	ArrayList<String> tags;
	
	
	
	public FileTags(String fileName, String path)
	{
		this.fileName = fileName;
		this.path = path;
		this.tags = new ArrayList<String>();
	}

	/**
	 * This function add the new tag if this tag wasn't added before
	 * @param tag is the tag of the file we want to add to list 'tags'
	 */
	void addTag(String tag)
	{
		//this for loop run over the list tags and check if 'tag' was added before
		for (int i = 0; i < tags.size(); i++)
		{
			if (tags.get(i).equals(tag))
				return;
		}
		//the case 'tag' wasn't added before
		tags.add(tag);
	}

	/**
	 * @param new_tag - is the tag we want to check if exists in the list 'tags'
	 * @return true if the list contains this tag. else - return false
	 */
	public boolean doesContain(String new_tag)
	{
		return tags.contains(new_tag);
	}
	
	/*get and set functions*/
	
	public String getFileName()
	{
		return fileName;
	}

	public void setFileName(String fileName)
	{
		this.fileName = fileName;
	}

	public String getPath()
	{
		return path;
	}

	public void setPath(String path)
	{
		this.path = path;
	}

	public ArrayList<String> getTags()
	{
		return tags;
	}

	public void setTags(ArrayList<String> tags)
	{
		this.tags = tags;
	}
}
